/*
 *  em.h
 *  bgsubtraction
 *
 *  Created by a1gucis on 3/17/09.
 *  Copyright 2009 __MyCompanyName__. All rights reserved.
 *
 */

#ifndef EM_H
#define EM_H
#define MEANS_THRESHOLD 
#include <iostream>
#include "systeminclude.h"
#include "utils.h"
using namespace std;
class EM {
private:
	CvMat *samples, *clusters;
	CvEM emModel;
    CvEMParams params;
	int sampleIdx;
public:
	EM();
	~EM();
	void train(IplImage *, bool); // input: 1 channel or 3 channel image, number of clusters and a boolean value, whether new image size differs from the previous one
	void predict(IplImage *, IplImage *); //input: 1 channel or 3 channel image. output: 1 channel image with labels
	void setClusters(int);
	void init(int, int);
	const CvMat *get_means();
	const CvMat **get_covs();
	
	void run();
	IplImage *run2(IplImage *, int);
	IplImage *kMeans(IplImage *, int);
};


#endif